<!-- Select2 -->
<link rel="stylesheet" href="/static/plugins/select2/select2.min.css">
<!-- Select2 -->
<script src="/static/plugins/select2/select2.full.js"></script>
<script src="/static/plugins/select2/py.js"></script>
<!-- iCheck for checkboxes and radio inputs -->
<link rel="stylesheet" href="/static/plugins/iCheck/all.css">
<!-- iCheck 1.0.1 -->
<script src="/static/plugins/iCheck/icheck.min.js"></script>
<script src="/static/plugins/format-number/format-number.js"></script>
<link rel="stylesheet" type="text/css" href="/static/plugins/jQueryUI/jquery-ui.min.css"/>
<link rel="stylesheet" type="text/css" href="/static/plugins/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.css"/>
<script type="text/javascript" src="/static/plugins/jQueryUI/jquery-ui.js"></script>
<script type="text/javascript" src="/static/plugins/jquery-ui-timepicker/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="/static/plugins/jquery-ui-timepicker/jquery-ui-timepicker-zh-CN.js"></script>
<script>

    $(function () {
        $(".select2").select2();
        $('.select2_').each(function (index) {
            var max = Number($(this).attr('data-max'));
            $(this).select2({
                tags: true,
                maximumSelectionLength: max   //最多能够选择的个数
            });
        });
        //整数
        $('[data-type="number"]').each(function (index) {
            var index = 'n' + index;
            var index = new FormatNumber();
            index.init({
                trigger: $(this),
                decimal: Number($(this).attr('data-decimal')),
                minus: true,
            });
        });
        $('.flat-blue').iCheck({
            checkboxClass: 'icheckbox_flat-blue',
            radioClass: 'iradio_flat-blue'
        });
        $('.flat-green').iCheck({
            checkboxClass: 'icheckbox_flat-green',
            radioClass: 'iradio_flat-green'
        });
        $('.detailtime').datetimepicker({});
        $('.onlyyearmonth,.datepicker').datepicker({
            inline: true,
            showButtonPanel: true,
            changeMonth: true,
            changeYear: true,
            todayBtn: true,
            showOtherMonths: true,
            selectOtherMonths: true
        });
        var original_gotoToday = $.datepicker._gotoToday;
        $.datepicker._gotoToday = function(id) {
            var target = $(id),
                    inst = this._getInst(target[0]);
            original_gotoToday.call(this, id);
            this._selectDate(id, this._formatDate(inst, inst.selectedDay, inst.drawMonth, inst.drawYear));
        }

        $('.onlytime').timepicker();

    });

</script>
